home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / netconf / firewall.h < prev    next >
C/C++ Source or Header  |  1996-05-24  |  2KB  |  96 lines

  1. #pragma interface
  2. #ifndef FIREWALL_H
  3. #define FIREWALL_H
  4.  
  5. #ifndef MISC_H
  6.     #include "../misc/misc.h"
  7. #endif
  8.  
  9. struct IPFW_SRC{
  10.     SSTRING host;
  11.     SSTRING netmask;
  12.     int nbbit_msk;        // Computed number of bit in the netmask
  13.                         // to speed up the sort.
  14.     SSTRING portrange;
  15.     SSTRING ports;
  16.     SSTRING interface;    // eth0 ...
  17. };
  18.  
  19. class IPFW_RULE: public ARRAY_OBJ{
  20.     friend class IPFW_RULES;
  21. protected:
  22.     char active;        // Is this rules has been activated
  23.                 // by the user.
  24.     SSTRING protocol;    // icmp, udp, tcp, all
  25.     IPFW_SRC from;
  26.     IPFW_SRC to;
  27. public:
  28.     virtual void save()=0;
  29.     virtual int edit()=0;
  30.     virtual int setup_left(int doit, SSTRING *collect)=0;
  31.     virtual int setup_right(int doit, SSTRING *collect)=0;
  32.     /*~PROTOBEG~ IPFW_RULE */
  33. protected:
  34.     IPFW_RULE (const char *&buf);
  35.     IPFW_RULE (void);
  36. public:
  37.     int editk (DIALOG&dia, const char *title);
  38.     int nbbitmask (IPFW_SRC&f);
  39.     int nbbitmask_from (void);
  40.     int nbbitmask_to (void);
  41.     void present (char *buf);
  42. protected:
  43.     void savek (char *buf);
  44. public:
  45.     int setup (IPFW_SRC&f,
  46.          IPFW_SRC&t,
  47.          const char *type,
  48.          int doit,
  49.          SSTRING *collect);
  50.     /*~PROTOEND~ IPFW_RULE */
  51. };
  52.  
  53. class IPFW_RULE_FORWARD: public IPFW_RULE{
  54.     char masquerade;    // Masquerade while forwarding ?
  55.     /*~PROTOBEG~ IPFW_RULE_FORWARD */
  56. public:
  57.     IPFW_RULE_FORWARD (const char *buf);
  58.     IPFW_RULE_FORWARD (void);
  59.     int edit (void);
  60.     void save (void);
  61.     int setup_left (int doit, SSTRING *collect);
  62.     int setup_right (int doit, SSTRING *collect);
  63.     /*~PROTOEND~ IPFW_RULE_FORWARD */
  64. };
  65.  
  66. class IPFW_RULE_OUTPUT: public IPFW_RULE{
  67.     /*~PROTOBEG~ IPFW_RULE_OUTPUT */
  68. public:
  69.     IPFW_RULE_OUTPUT (const char *buf);
  70.     IPFW_RULE_OUTPUT (void);
  71.     int edit (void);
  72.     void save (void);
  73.     int setup_left (int doit, SSTRING *collect);
  74.     int setup_right (int doit, SSTRING *collect);
  75.     /*~PROTOEND~ IPFW_RULE_OUTPUT */
  76. };
  77.  
  78. class IPFW_RULE_INPUT: public IPFW_RULE{
  79.     /*~PROTOBEG~ IPFW_RULE_INPUT */
  80. public:
  81.     IPFW_RULE_INPUT (const char *buf);
  82.     IPFW_RULE_INPUT (void);
  83.     int edit (void);
  84.     void save (void);
  85.     int setup_left (int doit, SSTRING *collect);
  86.     int setup_right (int doit, SSTRING *collect);
  87.     /*~PROTOEND~ IPFW_RULE_INPUT */
  88. };
  89.  
  90. extern char FIREWALL[];
  91. extern char FORWARD[];
  92. extern char BLOCK[];
  93. extern char OUTPUT[];
  94.  
  95. #endif
  96.